package com.qf.usefull.dict;

import com.qf.usefull.dict.entity.Word;
import com.qf.usefull.dict.service.impl.MyDictImpl02;
import com.qf.usefull.dict.service.impl.MyDictImpl03;
import com.qf.usefull.dict.utils.DictionaryUtils;
import com.qf.usefull.dict.utils.WordUtils;

public class DictDemo {
    public static void main(String[] args) {

        Word[] wordArr = WordUtils.createWordArr(100000);
//        MyDictionary dict01 = new MyDictImpl01(10000);
//        DictionaryUtils.testAddSpeed(wordArr,dict01);
//        DictionaryUtils.testFindSpeed(wordArr,dict01);


//        Word[] wordArr1 = WordUtils.createWordArr(100000);
//        MyDictImpl02 dict02 = new MyDictImpl02(100000);
//        DictionaryUtils.testAddSpeed(wordArr,dict02);
//        DictionaryUtils.testFindSpeed(wordArr,dict02);

        MyDictImpl03 myDictImpl03 = new MyDictImpl03();

        for (int i = 0; i < wordArr.length; i++) { // 添加单词
            myDictImpl03.addWord(wordArr[i].getEnglish(),wordArr[i].getChinese());
        }

        for (int i = 0; i < 100; i++) { // 查找单词
            System.out.println(myDictImpl03.findWord(wordArr[i].getEnglish()));
        }

    }


}
